package itheima.zuiye.Test;

import itheima.d02.MyRunnable;
//​	掌握java中多线程基本使用
//
//**需求描述**：
//
//有100份礼品，小红，小明两人同时发送，当剩下的礼品小于10份的时候则不再送出，利用多线程模拟该过程并将线程的名称打印出来。并最后在控制台分别打印小红，小明各自送出多少分礼物。

public class Test {


    private static int xiaohongCount = 0;
    private static int xiaomingCount = 0;

    public static void main(String[] args) {

        Thread xiaohong = new Thread(new Sender("小红"));
        Thread xiaoming = new Thread(new Sender("小明"));


        xiaohong.start();
        xiaoming.start();


        try {
            xiaohong.join();
            xiaoming.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


        System.out.println("小红共送出 " + xiaohongCount + " 份礼品");
        System.out.println("小明共送出 " + xiaomingCount + " 份礼品");


    }
}